Show plugin load errors in strategy notifications#94
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a883b7f9f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| result["strategy_plugin_error"] = error | ||
| result["strategy_plugin_error_lines"] = build_strategy_plugin_error_notification_lines( | ||
| error, | ||
| translator=translator, |
There was a problem hiding this comment.
Keep translator bound for load-error fallback
When a configured strategy plugin fails to load, this new call tries to pass translator after attach_strategy_plugin_result() has already executed del translator a few lines above. In that error path Python raises UnboundLocalError here, so the cycle no longer returns a non-blocking result with strategy_plugin_error; it crashes instead of falling back to the built-in strategy rules.
Useful? React with 👍 / 👎.
a883b7f to
b257e49
Compare
b257e49 to
19cefce
Compare
Summary
Tests
from notifications.telegram import build_translator
from quant_platform_kit.common.strategy_plugins import build_strategy_plugin_error_notification_lines
zh = build_translator('zh')
print(build_strategy_plugin_error_notification_lines('JSONDecodeError: bad json', translator=zh)[0])
PY
Note: broader local pytest collection is blocked on this VPS by missing requests; CI installs repository requirements.